import coder.taiji.kafka.StringKafKaProducer;

/**
 * describe:
 *
 * @author helloworldyu
 * @date 2018/5/3
 */
public class ProducerTest {
	private StringKafKaProducer stringKafKaProducer;
	private boolean stop;

	public ProducerTest(StringKafKaProducer stringKafKaProducer) {
		this.stringKafKaProducer = stringKafKaProducer;
	}

	public void start() {
		stop = false;
		while (!stop) {
			try {
				Thread.sleep(1000);
				stringKafKaProducer.sendMessage("nihao");
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

	public void stop() {
		stop = true;
	}
}